package com.naiterui.ehp.bs.patient.bo.notice;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;

import com.naiterui.ehp.bs.patient.config.TemplateProperties;

/**
 * 用药提醒
 *
 * @author zhoupeipei
 * @date 2019-06-19 15:38
 * @since 1.0.0
 */
public class DrugRemind extends BaseNotice {
    private static final long serialVersionUID = -8852437140774673783L;
    /**
     * 药品名
     */
    private String drugName;

    public DrugRemind(String openId, String drugName) {
        super.setOpenId(openId);
        this.drugName = drugName;
    }

    public String getDrugName() {
        return drugName;
    }

    public void setDrugName(String drugName) {
        this.drugName = drugName;
    }

    @Override
    public String getTemplateLabel() {
        return "DRUG_REMIND";
    }

    @Override
    public void handleContent(List<TemplateProperties.Content> contentList) {
        Map<String, String> formatMap = new HashMap<>();
        formatMap.put("DRUG_NAME", this.getDrugName());
        super.formatData(contentList, formatMap);
    }

    @Override
    public boolean validate() {
        if (super.validate() && StringUtils.isNotBlank(drugName)) {
            return true;
        } else {
            return false;
        }
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }
}


